home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209s.zip / octave-2.09 / libs / f2c / libf77 / s_paus.c < prev    next >
C/C++ Source or Header  |  1994-05-06  |  1KB  |  67 lines

  1. #include "stdio.h"
  2. #include "f2c.h"
  3. #define PAUSESIG 15
  4.  
  5. #ifdef KR_headers
  6. #define Void /* void */
  7. #define Int /* int */
  8. #else
  9. #define Void void
  10. #define Int int
  11. #undef abs
  12. #undef min
  13. #undef max
  14. #include "stdlib.h"
  15. #include "signal.h"
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. extern int getpid(void), isatty(int), pause(void);
  20. #endif
  21.  
  22. extern VOID f_exit(Void);
  23.  
  24. static VOID waitpause(Int n)
  25. {
  26. return;
  27. }
  28.  
  29. #ifdef KR_headers
  30. int s_paus(s, n) char *s; ftnlen n;
  31. #else
  32. int s_paus(char *s, ftnlen n)
  33. #endif
  34. {
  35. int i;
  36.  
  37. fprintf(stderr, "PAUSE ");
  38. if(n > 0)
  39.     for(i = 0; i<n ; ++i)
  40.         putc(*s++, stderr);
  41. fprintf(stderr, " statement executed\n");
  42. if( isatty(fileno(stdin)) )
  43.     {
  44.     fprintf(stderr, "To resume execution, type go.  Any other input will terminate job.\n");
  45.     fflush(stderr);
  46.     if( getchar()!='g' || getchar()!='o' || getchar()!='\n' )
  47.         {
  48.         fprintf(stderr, "STOP\n");
  49.         f_exit();
  50.         exit(0);
  51.         }
  52.     }
  53. else
  54.     {
  55.     fprintf(stderr, "To resume execution, execute a   kill -%d %d   command\n",
  56.         PAUSESIG, getpid() );
  57.     signal(PAUSESIG, waitpause);
  58.     fflush(stderr);
  59.     pause();
  60.     }
  61. fprintf(stderr, "Execution resumes after PAUSE.\n");
  62. #ifdef __cplusplus
  63. return 0; /* NOT REACHED */
  64. }
  65. #endif
  66. }
  67.